
module Test.BitGetTest where

import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
import Data.Binary.Put
import Data.Binary.Strict.Util
import Data.Binary.Strict.BitUtil
import LLVM.Parser.Bits.BitGet
import LLVM.Parser.Bits.Primitives
import LLVM.Util
import Data.Int
import Data.Bool
import Data.Word

import Control.Monad.State

import Numeric
import Test.QuickCheck

strictToLazy :: B.ByteString -> L.ByteString
strictToLazy strict = L.fromChunks [strict]

lazyToStrict :: L.ByteString -> B.ByteString
lazyToStrict lazy = head $ L.toChunks lazy

tst = do
        getFBR 6
        a <- getFBR 6
        return a
        
--test :: String
--test = 
--        let testBB = B.cons 0x81 $ B.cons 0x23 $ B.cons 0x91 B.empty in
--        case (runBitGet testBB $ unliftError tst) of Right m -> m
--                                                   Left m -> m
                       
test2 :: IO ()
test2 = let testBB = B.cons 0x81 $ B.cons 0x23 $ B.cons 0x91 B.empty in
        case (runBitGet testBB $ unliftError tst) of 
	         Right x -> putStrLn $ show x
	         Left m -> putStrLn m

